<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;


class CreateWalletTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wallet', function (Blueprint $table) {
            $table->increments('id')->autoIncrement();
            $table->integer('user_id')->comment('用户ID');
            $table->decimal('money',12,2)->default(0)->comment('用户账户余额');
            $table->decimal('shop_money',12,2)->default(0)->comment('店铺收益');
            $table->decimal('deposit',12,2)->default(0)->comment('押金');
            $table->decimal('tmc',20,8)->default(0)->comment('用户代币余额');
            $table->decimal('computing_power',12,0)->default(0)->comment('用户当前算力');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `wallet` comment '钱包表';");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wallet');
    }
}
